
function enableDisable(elem) {
  var e = elem.parentNode.nextSibling;
  
  while (e != null && e.nodeName != "LI") {
    e = e.nextSibling;
  }
  
  if (e.className == "valeur") {
    var le = e.childNodes;
    for (var i=0; i<le.length; i++) {
      if (le[i].nodeName == "INPUT") {
        le[i].disabled = !elem.checked;
      }
    }
  }
}

function selectDisplay(tr) {
  tr.style.backgroundColor="#5D5";
  tr.style.fontWeight="bold";
}

function deselectDisplay(tr) {
  var input = tr.getElementsByTagName("input")[0];
  if (input.checked == true) {
    tr.style.backgroundColor = "#DDD";
  } else {
    tr.style.backgroundColor = "#FFF";
  }
  tr.style.fontWeight="normal";
}

function deleteDisplay(input) {
  var tr = input.parentElement.parentElement;
  if (input.checked == true) {
    tr.style.backgroundColor = "#DDD";
    tr.style.textDecoration = "line-through";
    tr.style.color = "#F00";
  } else {
    tr.style.backgroundColor = "#FFF";
    tr.style.textDecoration = "none";
    tr.style.color = "#000";
  }
}

function afficheFormulaire(td){
  var input = td.parentElement.getElementsByTagName("input")[0];
  
  var id = input.value;
  var w = window.outerWidth;
  var h = window.outerHeight;
  
  if (w && h) {
    var l = w/2 - 250;
    var t = h/2 - 300;
    window.open("modifieClient.jsp?id="+id, "popup", "width=600,height=500,left="+l+",top="+t);
  } else {
    window.open("modifieClient.jsp?id="+id, "popup", "width=600,height=500");
  }
}
